/*
 * @Author: your name
 * @Date: 2021-07-07 14:08:53
 * @LastEditTime: 2021-11-20 17:07:28
 * @LastEditors: Please set LastEditors
 * @Description: 会员标签数据封装
 * @FilePath: \ebc-admin\src\views\member\config\setTag.js
 */
// 标签类型选项
const types = [
  { value: '2', title: '全部' },
  { value: '0', title: '自动标签' },
  { value: '1', title: '手动标签' }
]
// 标签状态
const stutas = [
  { value: '0', title: '未生成' },
  { value: '1', title: '生成中' },
  { value: '2', title: '已生成' }
]

// 搜索栏配置
export const searchs = [
  { type: 'input', key: 'tagName', value: '', placeholder: '会员标签名称' },
  { type: 'select', key: 'tagType', value: '', selectList: types, placeholder: '标签类型' },
  { type: 'select', key: 'tagStatus', value: '', selectList: stutas, placeholder: '状态' }
]


// el-table列表配置
export const listHedar = [
  { label: '会员标签编号', prop: 'tagId' },
  { label: '会员标签名称', prop: 'tagName' },
  { label: '会员标签描述', prop: 'description' },
  { label: '标签类型',     prop: 'tagType' ,isTemplate: true},
  { label: '有效时长(天)', prop: 'expire' ,isTemplate: true},
  { label: '会员数量',     prop: 'memberCount' },
  { label: '状态',         prop: 'tagStatus' ,isTemplate: true },
  { label: '修改人',       prop: 'modifierName' },
  { label: '修改时间',     prop: 'gmtModified'},
  { label: '操作',         prop: 'operate', isTemplate: true, fixed: 'right' }
]


// ========================添加会员标签======================

export function editListHanlder(init) {
  const editList = [
    {type: 'input', label: '会员标签名称：', key: 'tagName', value: '' , placeholder:'请输入',have:true},
    {type: 'textarea', label: '会员标签描述：', key: 'description', value: ''},
    {type: 'radio', label: '标签类型：', key: 'tagType', value: '' ,data:[{title:'自动标签',value:'0'},{title:'手动标签',value:'1'}] ,have:true},
  ]

  if(init) return editList
}

// 自动标签label
export const labelForm1 = [
   {label:'用户属性：' ,key: 'userProperty' , value: ''},
   {label:'行为属性：' ,key: 'actionProperty', value: '' },
   {label:'商务属性：' ,key: 'businessProperty' , value: ''},
]
// 手动标签label
export const labelForm2 = [
  { label:'有效时长：',key:'expire', key1:'expire1',type:'input-checkbox',value: '',name:'永久',disabled:false, have: true },
]

export  function setTagsProto() {
  const operator = [
    { key:'0', value: '==', label: '==' },
    { key:'1', value: '!=', label: '!=' },
    { key:'2', value: '<', label: '<' },
    { key:'3', value: '<=', label: '<=' },
    { key:'4', value: '>', label: '>' },
    { key:'5', value: '>=', label: '>=' },
   
  ]
  const data = [
    {label: '' ,value: '', data: [{ label:'陕西省',value:'001'}] },
    {label: '' ,value: '' , data: [{ label:'河北省',value:'00101'},{ label:'重庆',value:'00102'}] },
  ]
  const options =[ 
    { label: '普通会员', value: '1' }, 
    { label: 'VIP会员', value: '2' },
  ]
  const radioList = [
    {label: '全部',value: '0' },
    {label: '男' , value: '1' },
    {label: '女' , value: '2' }
  ]
  // 用户属性
  const userProperty = [
    { type: 'select-input', term: '',select: { value: '', options: operator },label: '注册时长：', key: 'registrationTime', dynamicTags: []},
    { type: 'select-input', term: '',select: { value: '', options: operator },label: '年龄：',  key: 'age',  dynamicTags: []}, 
    { type: 'radio-group',  label: '性别：',  key: 'gender',value:'', radioList: radioList, 
      getValue() {
        return this.value ? {name: this.value, key: 'gender' ,term: this.value ,operator: ''} : null
      },
      delete() { 
        this.value = '' 
      },
      dynamicTags: []
    },   
    { type: 'select-group', label: '所在城市：', key: 'city' ,value: [] , placeholder:'选择城市' , dynamicTags: []},
    { type: 'select-ninput',label: '会员等级：', key: 'leverName',options:options ,value: '' , placeholder:'会员等级', dynamicTags: []},
  ]
  // 行为属性
  const actionProperty = [
    { type: 'select-input', label: '最后登录时间：', key: 'lastLoginTime',term: '',select: { value: '', options: operator} , dynamicTags: []},
    { type: 'select-input', label: '发布动态：', key: 'dynamicCount',term: '',select: { value: '', options: operator} , dynamicTags: []},
    { type: 'select-input', label: '发布评论：', key: 'dynamicCommentCount',term: '',select: { value: '', options: operator}  , dynamicTags: []},
    { type: 'select-input', label: '动态转发：', key: 'dynamicForwardCount',term: '',select: { value: '', options: operator}  , dynamicTags: []},
    { type: 'select-input', label: '发起话题：', key: 'topicCount',term: '',select: { value: '', options: operator}  , placeholder:'选择逻辑' , dynamicTags: []},
  ]
//  商务属性
  const businessProperty =  [
    { type: 'select-input', label: '交换名片数：', key: 'exchangeCardCount',term: '',select: { value: '', options: operator} , dynamicTags: []},
    { type: 'select-input', label: '关注企业数：', key: 'followCompanyCount',term: '',select: { value: '', options: operator} , dynamicTags: []},
    { type: 'select-input', label: '咨询数：', key: 'consultCount',term: '',select: { value: '', options: operator} , dynamicTags: []},
  ]

  return { userProperty , actionProperty , businessProperty }

}
// 
export const rules = {
  tagName: [{ required: true, message: '请输入会员标签名称' , trigger: 'blur'}],
  tagType: [{ required: true, message: '请选择标签类型', trigger: 'blur' }],
}


